﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.Common.DEncrypt;

namespace Maticsoft.Web
{
    public partial class UserPwd : PageBaseMember
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Check();
            UserLeft1.FlagId = "2";
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            string old = DEncrypt.Encrypt(txtOldPwd.Text);
            string pwd = DEncrypt.Encrypt(txtNewPwd.Text);
            BLL.Members meBLL = new BLL.Members();
            Model.Members meModel = meBLL.GetModel(int.Parse(this.UserId));
            if (meModel.Password == old)
            {
                meModel.Password = pwd;
                meModel.UpdateTime = DateTime.Now;
                meBLL.Update(meModel);
                Common.MessageBox.Show(this.Page, "修改成功");
            }
            else
            {
                Common.MessageBox.Show(this.Page, "原始密码错误");
            }
        }
    }
}